package com.example.demo.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.demo.entity.Person;
import com.example.demo.service.PersonService;
@Controller
@RequestMapping("person")
public class PersonController {
	@Resource
	private PersonService personService;

	@RequestMapping("insert")
	@ResponseBody
	public Person insert(Person person) {
		return personService.insert(person);
	}
	
	@RequestMapping(value="all",method=RequestMethod.GET)
	@ResponseBody
	public List<Person> findall() {
		return personService.findall();
	}
}
